Ext.define('Jason.view.protal.authentication.Login', {
    extend: 'Jason.view.protal.authentication.LockingWindow',
    xtype: 'pageslogin',
    alternateClassName: 'pageslogin',
    requires: [
        'Ext.Component',
        'Wys.form.field.CheckCode',
        'Jason.view.protal.authentication.Register',
        'Jason.view.protal.authentication.AuthenticationModel',
        'Jason.view.protal.authentication.Dialog',
        'Ext.container.Container',
        'Ext.form.field.Text',
        'Wys.locale.Locale',
        'Jason.store.ReqUrl',
        'Ext.form.field.Checkbox',
        'Ext.button.Button'
    ],

    title: I18N.LoginTitle,
    defaultFocus: 'authdialog', // Focus the Auth Form to force field focus as well
    items: [
        {
            xtype: 'authdialog',
            defaultButton: 'loginButton',
            autoComplete: true,
            bodyPadding: '20 20',
            cls: 'auth-dialog-login',
            header: false,
            width: 480,
            layout: {
                type: 'vbox',
                pack: 'right',
                align: 'stretch'
            },

            defaults: {
                margin: '5 0'
            },

            items: [
                {
                    xtype: 'label',
                    //                    text: I18N.LoginLabel+cfg.systemname
                    html: '<fieldset style="border-color: #fff;border-width: 1px 0 0;border-style: solid;">' +
                        '	<legend style="margin-left: 20px;padding: 0 10px;font-size: 20px;font-weight: 300;color:#fff;">' +
						 	/*I18N.LoginLabel+*/cfg.systemname
                        + '</legend>' +
                        '</fieldset>'
                },
                {
                    xtype: 'textfield',
                    cls: 'auth-textbox',
                    name: 'userid',
                    bind: '{userid}',
                    height: 55,
                    hideLabel: true,
                    allowBlank: false,
                    emptyText: I18N.UserId,
                    listeners: {
                        specialkey: function (field, e) {
                            if (e.getKey() == Ext.EventObject.ENTER) {
                                field.up().down('textfield[name=password]').focus(true, false);
                            }
                        }
                    },
                    triggers: {
                        glyphed: {
                            cls: 'trigger-glyph-noop auth-email-trigger'
                        }
                    }
                },
                {
                    xtype: 'textfield',
                    cls: 'auth-textbox',
                    height: 55,
                    hideLabel: true,
                    emptyText: I18N.Password,
                    inputType: 'password',
                    name: 'password',
                    bind: '{password}',
                    allowBlank: false,
                    listeners: {
                        specialkey: function (field, e) {
                            if (e.getKey() == Ext.EventObject.ENTER) {
                                var loginBtn = field.up().lookupReference('loginButton');
                                loginBtn.fireEvent('click', loginBtn);
                            }
                        }
                    },
                    triggers: {
                        glyphed: {
                            cls: 'trigger-glyph-noop auth-password-trigger'
                        }
                    }
                },/*{
                	xtype : 'container',
                	layout:'hbox',
                	items:[{
						xtype : 'checkcode',
						cls: 'auth-textbox',
						emptyText:'校验码',
						allowBlank:false,
						isLoader:true,
						heigh:55,
			            blankText : '验证码不能为空',
			            codeUrl: cfg.requestUrl+'/main/checkCode/getCode'+cfg.suffix
                	}]
                },*/{
                    xtype: 'container',
                    layout: 'hbox',
                    items: [
                        {
                            xtype: 'checkboxfield',
                            flex: 1,
                            style: 'border:0px;',
                            reference: 'remeberCheckBox',
                            //                            cls: 'form-panel-font-color rememberMeCheckbox',
                            height: 30,
                            listeners: { change: 'onPersistChange' },
                            bind: '{persist}',
                            boxLabel: I18N.RememberMe
                        }/*,
                        {
                            xtype: 'box',
                            html: '<a href="#authentication.passwordreset" style="color:#ffffff;" class="link-forgot-password"> 找回密码 ?</a>'
                        }*/
                    ]
                },
                {
                    xtype: 'button',
                    reference: 'loginButton',
                    scale: 'large',
                    ui: 'soft-green',//
                    //                    ui:'soft-unifiedLogin',
                    iconAlign: 'right',
                    iconCls: 'x-fa fa-angle-right',
                    text: I18N.LoginTitle,
                    formBind: true,
                    listeners: {
                        click: 'onLoginButton'
                    }
                },/*{
                    xtype: 'box',
                    html: '<div class="outer-div"><div class="seperator">或</div></div>',
                    margin: '10 0'
                },*/{
                    xtype: 'button',
                    scale: 'large',
                    ui: 'soft-blue',
                    iconAlign: 'right',
                    iconCls: 'x-fa fa-user-plus',
                    text: '注册账号',
                    listeners: {
                        click: 'onNewAccount'
                    }
                }
            ]
        }, {
            xtype: 'component',
            itemId: 'globalToast',
            floating: true,
            y: 10,
            shadow: false,
            hideMode: 'offsets',
            cls: 'global-toast',
            showAnimation: 'slideIn',
            html: ''
        }
    ],

    initComponent: function () {
        this.addCls('user-login-register-container');
        this.callParent(arguments);
    }
});
